package com.ccl.iot;

import com.ccl.iot.IOTInterface.IOTOnlineMonitorInterface;
import com.ccl.iot.IOTInterface.IOTOnlineMonitorInterface.IOTOnlineStatusChangeListener;
import com.ccl.iot.device.IOTDevice;

public class IOTOnlineMonitor extends IOTMonitor<IOTOnlineStatusChangeListener> implements IOTOnlineMonitorInterface {
	private IOTOnlineMonitorInterface iSource = this;

	public IOTOnlineMonitor(){
		
	}

	public IOTOnlineMonitor(IOTOnlineMonitorInterface aSource){
		if (aSource != null){
			iSource = aSource;
		}
	}
	
	@Override
	public boolean addOnlineStatusChangeListener(IOTOnlineStatusChangeListener aListener) {
		return super.addMonitorListener(aListener);
	}

	@Override
	public boolean removeOnlineStatusChangeListener(IOTOnlineStatusChangeListener aListener) {
		return super.removeMonitorListener(aListener);
	}

	public void onOnlineStatusChange(boolean aOnline){
		int tIndex = 0;
		IOTOnlineStatusChangeListener tListener;
		
		while((tListener = super.getMonitorListener(tIndex++)) != null){
//			tListener.onOnlineStatusChanged(iSource, aOnline);
		}
	}
}
